package com.zusmart.base.network.nio;

import com.zusmart.base.buffer.BufferAllocator;
import com.zusmart.base.looper.support.AbstractThreadEventLoopGroup;
import com.zusmart.base.network.ChannelOption;

public class NioChannelEventLoopGroup extends AbstractThreadEventLoopGroup {

	private final ChannelOption channelOption;
	private final BufferAllocator bufferAllocator;

	public NioChannelEventLoopGroup(ChannelOption channelOption,BufferAllocator bufferAllocator) {
		super(channelOption.getNioSelectorSize(), channelOption.getNioSelectorName());
		this.channelOption = channelOption;
		this.bufferAllocator = bufferAllocator;
	}

	@Override
	protected NioChannelEventLoop createEventLoop(String name) {
		return new NioChannelEventLoop(name, this);
	}

	@Override
	public NioChannelEventLoop getEventLoop() {
		return (NioChannelEventLoop) super.getEventLoop();
	}

	@Override
	public NioChannelEventLoop getEventLoop(int index) {
		return (NioChannelEventLoop) super.getEventLoop(index);
	}

	public ChannelOption getChannelOption() {
		return this.channelOption;
	}

	public BufferAllocator getBufferAllocator() {
		return this.bufferAllocator;
	}
	
}